package com.example.park_management.result;


import lombok.Data;

@Data
public class R<T> {

    private  Integer code;   //编码成功为1 失败为0或其他
    private String msg;  //报错的信息
    private T data;   //数据



    public static <T> R<T> success(T object) {
        R<T> r = new R<T>();
        r.data = object;
        r.code = 1;
        return r;
    }

    public static <T> R<T> error(String msg) {
        R r = new R();
        r.msg = msg;
        r.code = 0;
        return r;
    }

}
